package work.kingcrab.file.server.utils;

import work.kingcrab.file.server.enums.FileMimeEnums;

import java.util.Arrays;
import java.util.concurrent.atomic.AtomicBoolean;

/**
 * @author Yousheng Tao
 * @description tools
 * @since 2020/7/30 17:57
 */
public class ValidateMime {

    public static boolean validateFileMime(String mime){
        AtomicBoolean flag = new AtomicBoolean(false);
        FileMimeEnums[] mimes = FileMimeEnums.values();
        Arrays.stream(mimes).forEach(item -> {
            if(item.getMime().equals(mime)) {
                flag.set(true);
            }
        });
        return flag.get();
    }
}
